
package net.qiqbframework.persisthanding;

import net.qiqbframework.messaging.Message;
import net.qiqbframework.messaging.correlation.CorrelationDataProvider;

import java.util.HashMap;
import java.util.Map;

public class DelayPersistFlagDataProvider implements CorrelationDataProvider {

    public static final String DELAY_PERSIST_FLAG_DATA_KEY = "_aggregateRootDelayPersist";

    @Override
    public Map<String, ?> correlationDataFor(Message<?> message) {
        Map<String, Object> result = new HashMap<>();

        result.put(DELAY_PERSIST_FLAG_DATA_KEY, message.getMetaData().getOrDefault(DELAY_PERSIST_FLAG_DATA_KEY, false));
        return result;
    }

}
